﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Entetities;

namespace DAL
{
    public class BoLocDAL
    {
        DataHelper dh;
        public BoLocDAL()
        {
            dh = new DataHelper();
        }
        public DataTable getBoLoc(int manhomboloc)
        {
            DataTable dt = null;
            try
            {
                SqlParameter para = new SqlParameter("@manhom", manhomboloc);
                dt = dh.FieldSortTableSP("BoLoc_GetTheoMaNhom", para);
            }
            catch (Exception)
            {             
                throw;
            }
            return dt;
        }
        public DataTable getBoLoc(string manhomsanpham, string sql)
        {
            DataTable dt = null;
            try
            {
                SqlParameter para = new SqlParameter("@manhom", manhomsanpham);
                SqlParameter para1 = new SqlParameter("@loaibo", sql);
                dt = dh.FieldSortTableSP("BoLoc_NhomBoLoc", para, para1);
            }
            catch (Exception)
            {
                throw;
            }
            return dt;
        }

        //public BoLoc geBoLocEntity(int maboloc)
        //{
        //    DataTable dt = new DataTable();
        //    SqlParameter para = new SqlParameter("@maboloc", maboloc);
        //    dt = dh.FieldSortTableSP("BoLoc_getbyid", para);
        //    if (dt != null && dt.Rows.Count > 0)
        //    {
        //        DataRow row = dt.Rows[0];
        //        BoLoc entity = new BoLoc();
        //        entity.Maboloc = (int)row["Maboloc"];
        //        entity.Tenboloc = row["Tenboloc"].ToString();
        //        entity.Manhomboloc = (int)row["Manhomboloc"];
        //        entity.Tennhomboloc = row["Tennhomboloc"].ToString();
        //        return entity;
        //    }
        //    return null;
        //}
    }
}
